import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';

//微服务管理单条查询
export const querySysMicroService = (params) => {
  params.head.transCode = 'querySysMicroService';
  return request({
    url: '/micro/sysMicroService/querySysMicroService',
    method: 'post',
    data: params
  })
}
//微服务管理多条列表查询，支持条件查询
export const querySysMicroServiceListPage = (params) => {
  params.head.transCode = 'querySysMicroServiceListPage';
  return request({
    url: '/micro/sysMicroService/querySysMicroServiceListPage',
    method: 'post',
    data: params
  })
}
//微服务管理新增单条记录
export const saveSysMicroService = (params) => {
  params.head.transCode = 'saveSysMicroService';
  return request({
    url: '/micro/sysMicroService/saveSysMicroService',
    method: 'post',
    data: params
  })
}
//微服务管理新增多条记录
export const saveSysMicroServiceList = (params) => {
  params.head.transCode = 'saveSysMicroServiceList';
  return request({
    url: '/micro/sysMicroService/saveSysMicroServiceList',
    method: 'post',
    data: params
  })
}
//微服务管理新增或修改单条记录
export const saveOrUpdateSysMicroService = (params) => {
  params.head.transCode = 'saveOrUpdateSysMicroService';
  return request({
    url: '/micro/sysMicroService/saveOrUpdateSysMicroService',
    method: 'post',
    data: params
  })
}


//微服务管理新增或修改单条记录
export const saveOrUpdateSysMicroServiceList = (params) => {
  params.head.transCode = 'saveOrUpdateSysMicroServiceList';
  return request({
    url: '/micro/sysMicroService/saveOrUpdateSysMicroServiceList',
    method: 'post',
    data: params
  })
}

//微服务管理修改单条记录
export const updateSysMicroService = (params) => {
  params.head.transCode = 'updateSysMicroService';
  return request({
    url: '/micro/sysMicroService/updateSysMicroService',
    method: 'post',
    data: params
  })
}

//微服务管理删除单条记录
export const deleteSysMicroService = (params) => {
  params.head.transCode = 'deleteSysMicroService';
  return request({
    url: '/micro/sysMicroService/deleteSysMicroService',
    method: 'post',
    data: params
  })
}

//微服务管理删除多条记录
export const deleteSysMicroServiceList = (params) => {
  params.head.transCode = 'deleteSysMicroServiceList';
  return request({
    url: '/micro/sysMicroService/deleteSysMicroServiceList',
    method: 'post',
    data: params
  })
}
//微服务管理导出excel
export const exportSysMicroServiceExcel = (params) => {
  downloadExcel({
    url: '/micro/sysMicroService/excelDownload/exportSysMicroServiceExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
